package com.xiashitech.agent.instrumentation.base.context;

import java.util.Objects;

/**
 * trace传递变量的名称，包含传递模式
 * @author zhaoyk
 */
public class ContextVarName {

    private int passMode;

    private String name;

    public ContextVarName(int passMode, String name) {
        this.passMode = passMode;
        this.name = name;
    }

    public ContextVarName(String name) {
        this(TraceContextVars.PASS_MODE_THROUGH, name);
    }

    public String getName() {
        return name;
    }

    public int getPassMode() {
        return passMode;
    }

    public void setPassMode(int passMode) {
        this.passMode = passMode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        ContextVarName that = (ContextVarName) o;
        return passMode == that.passMode && Objects.equals(name, that.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(passMode, name);
    }

}
